package com.zqg8512.netty.reponse;

import com.alibaba.fastjson.JSON;

/**
 * @Author zengqianggang
 * @Description //TODO
 * Author VPN
 * @Date 2019/9/30 11:08
 * @Version 1.0
 **/
public class ReponseTO {

    private Integer status;

    private String message;

    private Object data;


    public static ReponseTO ok(Object data){
        return ok(null, data);
    }

    public static ReponseTO ok(String message, Object data){
        return new ReponseTO(200,message, data);
    }

    public static ReponseTO fail(String message){
        return fail(message, null);
    }

    public static ReponseTO fail(String message, Object data){
        return new ReponseTO(500, message, data);
    }

    public ReponseTO(Integer status, String message, Object data) {
        this.status = status;
        this.message = message;
        this.data = data;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
